<?php

/**
 * Loan filter form base class.
 *
 * @package    vmdai
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLoanFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'remainder'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'purpose'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'list_type'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'title'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'money'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'user_id'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'is_day'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'term_num'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'money_rate'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'end_time'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'begin_time'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'service_fee'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cash'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'status'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'way_repayment'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'has_dividend'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'available_money' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'interest_sum'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'blocked_money'   => new sfWidgetFormFilterInput(),
      'is_advance'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'remainder'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'purpose'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'list_type'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'title'           => new sfValidatorPass(array('required' => false)),
      'money'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'user_id'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_day'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'term_num'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'money_rate'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'end_time'        => new sfValidatorPass(array('required' => false)),
      'begin_time'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'service_fee'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'cash'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'status'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'way_repayment'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'has_dividend'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'available_money' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'interest_sum'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'blocked_money'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'is_advance'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('loan_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Loan';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'remainder'       => 'Number',
      'purpose'         => 'Number',
      'list_type'       => 'Number',
      'title'           => 'Text',
      'money'           => 'Number',
      'user_id'         => 'Number',
      'is_day'          => 'Boolean',
      'term_num'        => 'Number',
      'money_rate'      => 'Number',
      'end_time'        => 'Text',
      'begin_time'      => 'Date',
      'service_fee'     => 'Number',
      'cash'            => 'Boolean',
      'status'          => 'Number',
      'way_repayment'   => 'Number',
      'has_dividend'    => 'Boolean',
      'available_money' => 'Number',
      'interest_sum'    => 'Number',
      'blocked_money'   => 'Number',
      'is_advance'      => 'Number',
      'created_at'      => 'Date',
      'updated_at'      => 'Date',
    );
  }
}
